package com.test.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.test.domain.Dept;
import com.test.mapper.DeptMapper;
import com.test.service.DeptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author Administrator
* @description 针对表【dept(部门表)】的数据库操作Service实现
* @createDate 2023-10-16 14:35:20
*/
@Service
public class DeptServiceImpl implements DeptService{

	@Resource
	DeptMapper deptMapper;
	
	@Override
	public PageInfo<Dept> selectForPageInfo(Dept dept) {
		PageInfo<Dept> pageInfo = PageHelper.startPage(dept.getPageNum(), dept.getPageSize()).doSelectPageInfo(() -> {
			deptMapper.selectAll(dept);
		});
		return pageInfo;
	}
	
	@Override
	public List<Dept> selectAll(Dept dept) {
		return deptMapper.selectAll(dept);
	}
	
	@Override
	public Dept selectOne(Integer id) {
		return deptMapper.selectOne(id);
	}
	
	@Override
	public int add(Dept dept) {
		return deptMapper.add(dept);
	}
	
	@Override
	public int update(Dept dept) {
		return deptMapper.update(dept);
	}
	
	@Override
	public int delete(Integer id) {
		return deptMapper.delete(id);
	}
	
	/**
	 * 批量删除部门对象
	 * @param ids 部门对象id数组
	 * @return int
	 */
	@Override
	public int deletes(Integer[] ids){
		return deptMapper.deletes(ids);
	}
}




